<extend name="Public/layout"/>

<block name="script">
    <style type="text/css">
        .ztree-manual{min-height: 500px;}
        .manual-left{
            top: 100px;
            bottom: 50px;
            position: absolute;
            padding-right: 0px;
            overflow: auto;
        }
        .manual-right{
            top: 100px;
            right: 0px;
            bottom: 50px;
            position: absolute;
            overflow: auto;
        }
    </style>
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/ztree/css/zTreeStyle/zTreeStyle.css">
    <script type="text/javascript" src="__PUBLIC__/ztree/js/jquery.ztree.all-3.5.min.js" charset="utf-8"></script>
    <script type="text/javascript">
        $(function(){
            //ztree设置
            var setting = {
                data:{
                    key:{
                        children:'_child',
                        name:'title',
                    }
                },
                callback:{
                    onClick: ztree_node_click
                }
            };

            //回调函数点击事件
            function ztree_node_click(event, treeId, treeNode){
                $.get("{:U('Category/getDetail')}", {id:treeNode.id}, function(data){
                    if(data.status == 1){
                        var node = data.data;
                        node = eval('('+node+')');
                        $('#ztree-manual-content').html(node.content);
                    }else{
                        alertMessager(data.info, 'danger');
                    }
                });
            };

            //获取目录列表
            $.get("{:U('Category/getCategoryTree', array('id' => $__CURRENT_CATEGORY__, 'group' => $__CURRENT_CATEGORY_GROUP__))}").success(function(data){
                if(data.status == 1){
                    var nodes = data.data;
                    $.fn.zTree.init($("#ztree-manual"), setting, eval('('+nodes+')'));
                }else{
                    alertMessager(data.info, 'danger');
                }
            });

        });
    </script>
</block>

<block name="jumbotron"></block>

<block name="top-nav">
    <nav class="navbar navbar-inverse navbar-fixed-top navbar-auto-hiding" role="navigation">
        <div class="container-fluid">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse-main">
                    <span class="sr-only">切换导航</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <php>if(C('WEB_SITE_LOGO')):</php>
                    <a class="navbar-brand" href="__ROOT__/"><img alt="Brand" class="brand" src="{$Think.config.WEB_SITE_LOGO|get_cover='path'}"></a>
                <php>else:</php>
                    <a class="navbar-brand" href="__ROOT__/">{:C('WEB_SITE_TITLE')}</a>
                <php>endif;</php>
            </div>
            <div class="collapse navbar-collapse navbar-collapse-main">
                <ul class="nav navbar-nav">
                    <li><a href="__ROOT__/">首页</a></li>
                    <corethink:category_list name="vo">
                        <li <if condition='$vo.id eq $__CURRENT_CATEGORY__'> class="active"</if> >
                            <a href="{:U('Document/index', array('cid' => $vo['id']))}">{$vo.title}</a>
                        </li>
                    </corethink:category_list>
                </ul>
                <ul class="nav navbar-nav navbar-right">
                    <present name="__USER__">
                        <li class="dropdown">
                            <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                                <i class="fa fa-user"></i> {$__USER__.username}
                                <span class="caret"></span>
                            </a>
                            <ul class="dropdown-menu">
                                <li><a href="{:U('User/index')}"><i class="fa fa-home"></i> 个人主页</a></li>
                                <li><a href="{:U('User/center')}"><i class="fa fa-tachometer"></i> 个人中心</a></li>
                                <li><a href="{:U('UserMessage/index')}"><i class="fa fa-envelope"></i> 消息中心</a></li>
                                <li><a href="{:U('Addon/index')}"><i class="fa fa-weixin"></i> 微＋平台</a></li>
                                <li class="divider hidden-xs"></li>
                                <li><a href="{:U('User/logout')}" class="ajax-get"><i class="fa fa-sign-out"></i> 退出登录</a></li>
                            </ul>
                        </li>
                    <else />
                        <li><a href="#" data-toggle="modal" data-target="#login-modal">登录</a></li>
                        <li><a href="{:U('User/register')}">注册</a></li>
                    </present>
                </ul>
            </div>
        </div>
    </nav>
</block>

<block name="breadcrumb">
    <div class="container-fluid">
        <div class="row">
            <ul class="breadcrumb">
                <li><i class="icon-location-arrow"></i></li>
                <li><a href="__ROOT__/">首页</a></li>
                <corethink:breadcrumb name="_breadcrumb" cid="$__CURRENT_CATEGORY__" group="$__CURRENT_CATEGORY_GROUP__">
                    <li><a href="{:U('Document/index', array('cid' => $_breadcrumb['id']))}">{$_breadcrumb.title}</a></li>
                </corethink:breadcrumb>
            </ul>
        </div>
    </div>
</block>

<block name="body">
    <section class="main">
        <div class="col-xs-12 col-sm-2 manual-left">
            <div class="ztree ztree-manual box" id="ztree-manual"></div>
        </div>
        <div class="col-xs-12 col-sm-10 manual-right">
            <div class="ztree-manual box" id="ztree-manual-content">{$info.content}</div>
        </div>
    </section>
</block>

<block name="footer">
    <footer class="footer navbar-fixed-bottom border-top">
        <div class="container">
            <div class="row padding-top">
                <ul class="list-inline text-center">
                    <li>{:C('WEB_SITE_COPYRIGHT')}</li>
                    <li><a class="padding-left border-left" href="http://www.miibeian.gov.cn/" target="_blank">{:C('WEB_SITE_ICP')}</a></li>
                    <li><a href="http://www.corethink.cn" title="轻量级WEB产品开发框架"><span class="label label-default">CorerThink</span></a></li>
                </ul>
            </div>
        </div>
    </footer>
</block>
